Skip to content

Apply per-gene multiple testing correction for site selection metrics#460

Merged
FerriolCalvet merged 5 commits into
devfrom
copilot/apply-multiple-testing-correction
Jun 1, 2026
Merged

Apply per-gene multiple testing correction for site selection metrics#460
FerriolCalvet merged 5 commits into
devfrom
copilot/apply-multiple-testing-correction

Conversation

Copilot AI commented May 21, 2026

Copy link
Copy Markdown
Contributor

Site selection p-values must be corrected per gene (not across the full panel). The site comparison output should include both raw and adjusted p-values for downstream consumers.

  • Per-gene multiple testing
    • Apply Benjamini–Hochberg correction within each GENE group in omega_comparison_per_site.py.
  • Output surface
    • Emit p_value_adj alongside p_value for each site/AA grouping.
result["p_value_adj"] = np.nan
for gene, gene_df in result.groupby("GENE", dropna=False):
    valid_mask = gene_df["p_value"].notna()
    if not valid_mask.any():
        continue
    adjusted = benjamini_hochberg(gene_df.loc[valid_mask, "p_value"].to_numpy())
    result.loc[gene_df.index[valid_mask], "p_value_adj"] = adjusted

Agent-Logs-Url: https://github.com/bbglab/deepCSA/sessions/78cc6f96-7594-4d38-93df-622555a78ba3

Co-authored-by: FerriolCalvet <38539786+FerriolCalvet@users.noreply.github.com>
Copilot AI changed the title [WIP] Add multiple testing correction for site selection analysis Apply per-gene multiple testing correction for site selection metrics May 21, 2026
Copilot AI requested a review from FerriolCalvet May 21, 2026 07:43
@FerriolCalvet FerriolCalvet marked this pull request as ready for review June 1, 2026 09:54
@FerriolCalvet

FerriolCalvet commented Jun 1, 2026

Copy link
Copy Markdown
Member

tested and works well!

  • pending to remove genes that are not in the panel from the results

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the per-site positive selection (“site comparison”) outputs to include per-gene multiple-testing correction (Benjamini–Hochberg) and surfaces the adjusted p-values to downstream consumers (notably saturation plots). It also wires an optional gene subset parameter through the Nextflow module invocation.

Changes:

  • Add p_value_adj to omega_comparison_per_site.py by applying Benjamini–Hochberg correction within each GENE group, after flooring underflowed p_value == 0.
  • Update saturation plotting logic to use adjusted p-values (p_value_adj / pvalue_adj) for significance decisions and adjust default significance threshold to 0.05.
  • Pass an optional --genes subset from Nextflow config/module into omega_comparison_per_site.py, and include compiled global-local omega results in summary inputs when enabled.

Reviewed changes

Copilot reviewed 3 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
workflows/deepcsa.nf Adds compiled global-local omega results into the positive selection result bundle for downstream summary/plotting.
modules/local/bbgtools/sitecomparison/main.nf Adds optional --genes argument plumbing to the site comparison process (currently introduces a command construction bug).
conf/tools/omega.config Wires params.selected_genes into the site comparison module via ext.genes_subset.
bin/utils.py Introduces shared MIN_NONZERO_PVALUE constant for p-value underflow flooring.
bin/plot_gene_saturation.py Switches significance logic to adjusted p-values and aligns defaults/inputs for global-local omega table usage.
bin/omega_comparison_per_site.py Implements per-gene BH correction and emits p_value_adj alongside raw p_value; adds --genes option.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread modules/local/bbgtools/sitecomparison/main.nf
@FerriolCalvet FerriolCalvet merged commit d012b74 into dev Jun 1, 2026
1 check passed
@FerriolCalvet FerriolCalvet deleted the copilot/apply-multiple-testing-correction branch June 1, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Apply multiple testing correction for site selection analysis

3 participants